/*******************************************
Module: zt_os.c
E-Mail: 24zhutian@gmail.com
Notices: Copyright (c) 2007-2010 ls
*******************************************/
#include "zt_config.h"
#include "zt_os.h"

ZT_API zt_uint_t zt_os_pagesize()
{
#ifdef _MSC_VER
	SYSTEM_INFO SystemInfo;	
	GetSystemInfo(&SystemInfo);
	return((zt_uint_t)SystemInfo.dwPageSize);
#endif
}

ZT_API zt_uint_t zt_os_cpu_count()
{
#ifdef _MSC_VER
	SYSTEM_INFO SystemInfo;	
	GetSystemInfo(&SystemInfo);
	return((zt_uint_t)SystemInfo.dwNumberOfProcessors);
#endif
}

ZT_API int zt_os_is_winnt()
{
	static int __os_type=-1;
	/*
	* The value of __os_type is computed only once, and cached to
	* avoid the overhead of repeated calls to GetVersion().
	*/
#ifdef _MSC_VER
	if (__os_type == -1) {
		if ((GetVersion() & 0x80000000) == 0){
			__os_type = 1;
		}
		else{
			__os_type = 0;
		}
	}
#endif
	return(__os_type);
}